<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="郝珍华">
    <title></title>
    <style>
        .conntainer {

            width: 500px;
            height: 200px;

            margin: 100px auto;
        }

        ul {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .inner li {
            width: 200px;
            height: 50px;
            float: left;
            font-size: 20px;
            text-align: center;
            line-height: 50px;
        }

        .xiangmu {
            background-color: lightcoral;
        }

        .xuanze {
            background-color: gray;
        }

        a {
            text-decoration: none;
            color: inherit;
            font-size: inherit;
        }

        .baoguo {
            height: 203px;
            border: 1px solid;
            display: none;
        }

        .baoguo1 li {
            border-bottom: 1px dashed;
        }

        .baoguo1 li:hover {
            background-color: gray;
        }
    </style>
</head>

<body>
    <div class="conntainer">
        <ul class="inner">
            <li class="xiangmu"><a href="#">选择项目：</a></li>
            <li class="xuanze">
                <a href="#">未选择</a>
                <div class="baoguo">
                    <ul class="baoguo1">
                        <li class="active"><a href="#">js</a></li>
                        <li><a href="#">css</a></li>
                        <li><a href="#">jq</a></li>
                        <li><a href="#">nodejs</a></li>
                    </ul>
                </div>
            </li>
        </ul>
    </div>
    <script src="./jquery.js"></script>
</body>

</html>
<script>
    var xuanze = $('.xuanze');
    var baoguo = $('.baoguo');
    var a1 = $('.xuanze').children('a');
    var a2 = $('.baoguo1').children('li');
    xuanze.click(function () {
        baoguo.show();
    })
    a2.click(function (ev) {
        ev.stopPropagation();
        baoguo.hide();
        var c = $(this).text()
        a1.text(c);
    });

</script>